<!DOCTYPE html>
<html>
  
  <head>
    <meta charset="UTF-8">
    <title>密码修改</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />

    <link rel="shortcut icon" href="/favicon.ico" type="image/x-icon" />
    <link rel="stylesheet" href="/static/xadmin/css/font.css">
	<link rel="stylesheet" href="/static/xadmin/css/xadmin.css">
    <script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.min.js"></script>
    <script src="/static/xadmin/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="/static/xadmin/js/xadmin.js"></script>

    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
      <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
      <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
  </head>
  
  <body>
    <div class="x-body">
      		<form class="layui-form layui-form-pane" action="" lay-filter="ChangePassword">
			 	<div class="layui-form-item">
   					<div class="layui-inline">
    					<label class="layui-form-label">旧密码</label>
    					<div class="layui-input-inline" style="width: 213px;">
      						<input type="password" name="oldpassword" placeholder="" lay-verify="pass" autocomplete="off" class="layui-input">
    					</div>
						<div class="layui-form-mid" style="color: red;">*</div>
   					</div>
				</div>
				<div class="layui-form-item">
   					<div class="layui-inline">
    					<label class="layui-form-label">新密码</label>
    					<div class="layui-input-inline" style="width: 213px;">
      						<input type="password" name="newpassword" placeholder="" lay-verify="pass" autocomplete="off" class="layui-input">
    					</div>
						<div class="layui-form-mid" style="color: red;">*</div>
   					</div>
				</div>
				<div class="layui-form-item">					
   					<div class="layui-inline">
    					<label class="layui-form-label">确认密码</label>
    					<div class="layui-input-inline" style="width: 213px;">
      						<input type="password" name="repeatpassword" placeholder="" lay-verify="pass" autocomplete="off" class="layui-input">
    					</div>
						<div class="layui-form-mid" style="color: red;">*</div>
   					</div>
  				</div>
        		<div class="layui-form-item">
          			<button class="layui-btn" lay-submit="" lay-filter="ChangePasswordSubmit">确认修改</button>
        		</div>
      		</form>
    </div>
<script>
    layui.use(['form','table'], function(){
		var table = layui.table;
        var form = layui.form;
            
        //监听提交
        form.on('submit(ChangePasswordSubmit)', function(data){		
			   layer.confirm('确定修改?', {icon: 3, title:'提示',yes: function(index){
                     $.ajax({
                       url: "/public/changepwd",
                       type: "post",
                       data: data.field,
					   headers:{'X-Requested-With':'XMLHttpRequest'},
                       dataType: "json",
                       success: function (resp) {
                                 if(resp.status){
                                    layer.msg('修改成功', {icon: 1});
                                 }else{
                                    layer.msg('修改失败',{icon:2});
                                 }
                        }
                   });		  	  
               	},
                cancel: function(index, layero){ 
                    layer.close(index);
		            console.log("不操作");
                } 
            	}); 		   
	      		return false; 	
		});		             
    });
</script>
  </body>

</html>